package com.solvePlat.controller;

import com.github.pagehelper.PageInfo;
import com.solvePlat.entity.WorkInfo;
import com.solvePlat.entity.WorkInfoComment;
import com.solvePlat.entity.base.BaseResponse;
import com.solvePlat.service.Impl.WorkInfoCommentServiceImpl;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/workInfoComment")
public class WorkInfoCommentController {

    @Resource
    private WorkInfoCommentServiceImpl workInfoCommentService;

    @GetMapping("/selectWorkInfoComment")
    public BaseResponse selectWorkInfoComment(WorkInfo workInfo){
        BaseResponse<PageInfo> baseResponse = new BaseResponse<PageInfo>();
        PageInfo pageInfo = workInfoCommentService.selectWorkInfoComment(workInfo);
        baseResponse.setMsg("查询成功!");
        baseResponse.setSuccess(true);
        baseResponse.setData(pageInfo);
        return baseResponse;
    }

    @GetMapping("/selectMeWorkInfoComment")
    public BaseResponse selectMeWorkInfoComment(WorkInfo workInfo){
        BaseResponse<PageInfo> baseResponse = new BaseResponse<PageInfo>();
        PageInfo pageInfo = workInfoCommentService.selectMeWorkInfoComment(workInfo);
        baseResponse.setMsg("查询成功!");
        baseResponse.setSuccess(true);
        baseResponse.setData(pageInfo);
        return baseResponse;
    }


    @PostMapping("/saveWorkinfoComment")
    public BaseResponse saveWorkinfoComment(@RequestBody WorkInfoComment workInfoComment){
        BaseResponse<String> baseResponse = new BaseResponse<String>();
        workInfoCommentService.saveWorkInfoCommentInfo(workInfoComment);
        baseResponse.setMsg("评论成功!");
        baseResponse.setSuccess(true);
        baseResponse.setData("");
        return baseResponse;
    }


    @GetMapping("/getMeWorkInfoCommentInfo")
    public BaseResponse getMeWorkInfoCommentInfo( WorkInfoComment workInfoComment){
        BaseResponse<WorkInfoComment> baseResponse = new BaseResponse<WorkInfoComment>();
        WorkInfoComment workInfoCommentResult = workInfoCommentService.getMeWorkInfoCommentInfo(workInfoComment);
        baseResponse.setMsg("评论成功!");
        baseResponse.setSuccess(true);
        baseResponse.setData(workInfoCommentResult);
        return baseResponse;
    }



}
